package cn.czh0123.query;

import cn.czh0123.exception.BusinessException;
import cn.czh0123.msg.CommonCodeMsg;
import lombok.Data;

/**
 * @author: czh
 * @description:
 * @date: 2024/3/24 14:36
 */
@Data
public class QueryObject {
    private Integer currentPage = 1;
    private Integer pageSize = 10;

    public Integer getCurrentPage() {
        if (currentPage <= 0) {
            throw new BusinessException(CommonCodeMsg.PARAM_INVALID);
        }
        return currentPage;
    }

    public Integer getPageSize() {
        if (pageSize <= 0) {
            throw new BusinessException(CommonCodeMsg.PARAM_INVALID);
        }
        return pageSize;
    }
}
